import {createApp} from 'vue'
//UI库
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'
//全局CSS
import "normalize.css/normalize.css"
import '@/style/index.scss'
//路由 & store
import router from './routes'
import store from './store'

//
import App from './App.vue'

const app = createApp(App)

import axios from '@/http_config/axios'

app.config.globalProperties.$http = axios

//SVG ICON组件
import 'virtual:svg-icons-register'
import svgIcon from '@/icons/SvgIcon.vue'

app.component('SvgIcon', svgIcon)
//
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
NProgress.configure({showSpinner: false}) // NProgress Configuration
//路由守卫
router.beforeEach(async (to, from, next) => {
    // start progress bar
    NProgress.start()
    // set page title
    document.title = to.meta.title ? `${to.meta.title}-数字化油库` : '数字化油库'
    next()
    NProgress.done()
})
router.afterEach(() => {
    // finish progress bar
    NProgress.done()
})

console.log(router)

app.use(ElementPlus, {
    locale, // 语言设置
    // size: 'small' // 尺寸设置large、default、small 默认default
})
app.use(router)
app.use(store)
app.mount('#app')
